#ifndef DATAPLOT_H
#define DATAPLOT_H
//
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_panner.h>
#include "datafile.h"
#include "peakitem.h"
//
class DataPlot : public QwtPlot
{
Q_OBJECT
public:
	void setCurrentChannel(int value) { currentChannel = value; }
	int getCurrentChannel() { return currentChannel; }
	explicit DataPlot( DataFile * file, QWidget * widget = NULL );
	explicit DataPlot( DataFile * file, const QwtText & title, QWidget * widget = NULL);
	virtual ~DataPlot();
//signals:
	// TO DO: update slider
public slots:
	void zoomOut();
	void zoomIn();
	void panPlot(double lPos);
private:
	void setView( qint64 begin, int width );
	void Init();
	QwtPlotCurve * d_curve;
	PeakItem * d_peakCurve;
	QwtCPointerData * d_data;
	CPointerPeakData * d_peakData;
	DataFile * d_file;
	int dataBegin;
	int dataEnd;
	int currentViewBegin;
	int currentViewEnd;
	float zoomFactor;
	int currentChannel;
protected:
//	virtual void paintEvent(QPaintEvent * event);
	virtual void resizeEvent(QResizeEvent * event);
};
#endif
